/**
 * 
 */
package weibo4j.examples.util;

import java.util.ArrayList;
import java.util.List;

import weibo4j.model.User;

/**
 * @author Administrator
 *
 */
public class Util {
    /**
     * 获取两个List的不同元素
     * @param list1
     * @param list2
     * @return
     */
    public static List<User> getDiffrent(List<User> list1, List<User> list2) {
        long st = System.nanoTime();
        List<User> diff = new ArrayList<User>();
        for(int i=0;i<list1.size();i++){
        	User user=list1.get(i);
        	boolean t=false;
        	for(int j=0;j<list2.size();j++){
        		User user2=list2.get(j);
        		if(user.getId().equals(user2.getId())){
        			t=true;
        			break;
        		}
            }
        	if(!t)
        		 diff.add(user);
        }
        System.out.println("getDiffrent total times "+(System.nanoTime()-st));
        System.out.println("getDiffrent total size "+diff.size());
        return diff;
    }
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
